//
//  SACommonProblemsCell.m
//  saasRetail
//
//  Created by 黄志刚 on 2022/1/5.
//

#import "SACommonProblemsCell.h"
#import "SACommonProblemsModel.h"
#import "SACommonProblemsDetailModel.h"

@interface SACommonProblemsCell ()

@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UIImageView *arrowImageV;

@end

@implementation SACommonProblemsCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initUI];
    }
    return self;
}

-(void)setModel:(SACommonProblemsModel *)model {
    _model = model;
    _titleLab.text = model.typeDesc;
}

-(void)setDetailModel:(SACommonProblemsDetailModel *)detailModel {
    _detailModel = detailModel;
    _titleLab.text = detailModel.question;
}

-(void)initUI {
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    [self.contentView addSubview:self.titleLab];
    [self.contentView addSubview:self.arrowImageV];
    
    [self.arrowImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-20);
        make.centerY.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(12.5, 21));
    }];
    
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.centerY.mas_equalTo(0);
        make.right.equalTo(self.arrowImageV.mas_right).offset(kScaleNum(-20));
    }];
}

-(UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.textAlignment = NSTextAlignmentLeft;
        _titleLab.font = kFont(14);
        _titleLab.textColor = kBlackColor;
    }
    return _titleLab;
}

- (UIImageView *)arrowImageV {
    if (!_arrowImageV) {
        _arrowImageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pay_arrow_right"]];
    }
    return _arrowImageV;
}
@end
